Skip to content

Conversation

@alexanderleegs
Copy link
Contributor

Uses our admin token to privatise repos, to fix github's changes to disallow write tokens to change repo status.

import { GitCommitResult } from "@root/types/gitfilesystem"
import { GitHubRepoInfo, RawGitTreeEntry, RepoState } from "@root/types/github"

import { E2E_TEST_GH_TOKEN } from "../middlewareServices/AuthenticationMiddlewareService"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we actually have this token at run time or is it only during e2e on local

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run time - we currently also use it for pr approval

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker but The name of the token is very misleading

@alexanderleegs alexanderleegs enabled auto-merge (squash) January 28, 2025 05:29
@alexanderleegs alexanderleegs enabled auto-merge (squash) January 28, 2025 05:34
// Privatising a repo is restricted to repo admins - an admin token will be inserted in via our axios interceptor
// Privatising a repo is restricted to repo admins - our main admin token is used
const headers = {
Authorization: "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come this was previously empty? Comment seems to say this was injected by the axios interceptor

If we are modifying to inject token here is the interceptor still needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interceptor always exists, and inserts in the token in cases where it doesn't exist (i.e. all email login actions). normally this is just to catch the github flow, where the user's personal github token wold be used (but they would lack perms)

In this case we're using the admin token for both flows, so no change

@alexanderleegs alexanderleegs merged commit bdc5492 into develop Jan 28, 2025
10 of 11 checks passed
@alexanderleegs alexanderleegs deleted the fix/privatisation-access-token branch January 28, 2025 05:52
@alexanderleegs alexanderleegs mentioned this pull request Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants